vmx realmode: Implement new x86_emulate hook load_fpu_ctxt().
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 23 Jan 2008 14:30:56 +0000 (14:30 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 23 Jan 2008 14:30:56 +0000 (14:30 +0000)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/hvm/vmx/realmode.c
xen/arch/x86/hvm/vmx/vmx.c
xen/include/asm-x86/hvm/vmx/vmx.h

index 39b1fdb590f8a3aa6d15818efee3eedaf90bf374..6bb778e965c293ee8694e64960d5aa6b5f75e909 100644 (file)
@@ -473,6 +473,13 @@ static int realmode_inject_sw_interrupt(
     return X86EMUL_OKAY;
 }
 
+static void realmode_load_fpu_ctxt(
+    struct x86_emulate_ctxt *ctxt)
+{
+    if ( !current->fpu_dirtied )
+        vmx_do_no_device_fault();
+}
+
 static struct x86_emulate_ops realmode_emulator_ops = {
     .read          = realmode_emulate_read,
     .insn_fetch    = realmode_emulate_insn_fetch,
@@ -491,7 +498,8 @@ static struct x86_emulate_ops realmode_emulator_ops = {
     .cpuid         = realmode_cpuid,
     .hlt           = realmode_hlt,
     .inject_hw_exception = realmode_inject_hw_exception,
-    .inject_sw_interrupt = realmode_inject_sw_interrupt
+    .inject_sw_interrupt = realmode_inject_sw_interrupt,
+    .load_fpu_ctxt = realmode_load_fpu_ctxt
 };
 
 void vmx_realmode(struct cpu_user_regs *regs)
index 3cb137268e8969cf3365395ed15deb6bb98dad67..486a7bf44ddf1c892dab2e07ab5d3d010b7b577a 100644 (file)
@@ -1214,7 +1214,7 @@ static void __update_guest_eip(unsigned long inst_len)
         vmx_inject_exception(TRAP_debug, HVM_DELIVER_NO_ERROR_CODE, 0);
 }
 
-static void vmx_do_no_device_fault(void)
+void vmx_do_no_device_fault(void)
 {
     struct vcpu *v = current;
 
index af50427ed3e3152dac6921d665447ee18d8490c4..ec03e75d9c3a3f3ec40aaf7e8ec6dd90c7338220 100644 (file)
@@ -33,6 +33,7 @@ void vmx_intr_assist(void);
 void vmx_do_resume(struct vcpu *);
 void set_guest_time(struct vcpu *v, u64 gtime);
 void vmx_vlapic_msr_changed(struct vcpu *v);
+void vmx_do_no_device_fault(void);
 void vmx_cpuid_intercept(
     unsigned int *eax, unsigned int *ebx,
     unsigned int *ecx, unsigned int *edx);